﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace SimTank
{
    public class Debuff
    {
        public int remaining, interval;
        public SchoolEnum spellschool;
        public int damage, maxstack;
        public DispelType dispeltype;
        public double threatmod;
        public int SpellID;

        private int _currentstack = 1;
        public int currentstack
        {
            get
            {
                return _currentstack;
            }
            set
            {
                if (value > maxstack)
                    _currentstack = maxstack;
                else
                    _currentstack = value;
            }
        }

        public Debuff()
        {
        }

        public Debuff(int SpellID, SchoolEnum spellschool, int damage, int interval, int remaining, DispelType dispeltype, double threatmod, int maxstack = 1)
        {
            this.SpellID = SpellID;
            this.spellschool = spellschool;
            this.damage = damage;
            this.interval = interval;
            this.remaining = remaining;
            this.dispeltype = dispeltype;
            this.threatmod = threatmod;
            this.maxstack = maxstack;
        }

        public Attack Tic()
        {
            Attack dotdamage = new Attack();
            dotdamage.name = (String)SimTankMainWindow.spellNameHash[SpellID];
            dotdamage.spellschool = spellschool;
            dotdamage.threatmod = threatmod;
            dotdamage.damage = 7; //define result 7 as a dot tic
            remaining--;
            if (remaining % interval == 0 && remaining > 0)
            {
                dotdamage.damage = damage;
            }
            else
                dotdamage.damage = 0;
            return dotdamage;
        }
    }
}

